package com.freewater.springboot.demo.aop.api.advised;

import org.jetbrains.annotations.NotNull;
import org.springframework.aop.AfterReturningAdvice;

import java.lang.reflect.Method;
import java.util.Arrays;

public class SimpleAfterAdvice implements AfterReturningAdvice {

    @Override
    public void afterReturning(Object returnValue,
                               Method method, Object @NotNull [] args,
                               Object target) {
        String msg = String.format("after advice, method: %s, args: %s, returnVal: %s",
                method.getName(),
                Arrays.toString(args),
                returnValue);
        System.out.println(msg);
    }
}
